package xjtu.sad.zbsj.dao.labelTask;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import xjtu.sad.zbsj.task.annotater.labelTask.*;

import java.util.List;

@Mapper
public interface LabelTaskDao {

    List<DrawInfo> getDrawList(int userId);

    TaskInfo getTaskInfo(Integer taskId);

    @Select("select count(*) from t_mark where draw_id=#{draw_id} and end_time is null")
    Integer getUnFinishedNum(Integer drawId);

    List<MarkInfo> getMarkInfoList(Integer drawId);

    TaskContent getTaskContent(Integer contentId);

    List<MarkDetail> getMarkDetailList(Integer markId);

    DrawDetailParam getBasicDrawInfo(Integer drawId);

    @Select("select count(*) from t_draw where draw_id = #{drawId}")
    boolean judgeDrawInfoExist(Integer drawId);

    void changeMarkInfo(List<MarkInfo> changedMarkInfoList);

    void changeMarkDetail(List<MarkDetail> markDetailList);

    void addMarkInfoDetail(List<MarkDetail> newMarkDetailList);

    List<Integer> getOldMarkDetail(Integer markId);

    void deleteMarkInfoDetail(List<Integer> deletedMarkDetailList);

    DrawDetailParam getBasicDrawInfoByTaskId(Integer taskId);

    List<MarkInfo> getMarkInfoListById(@Param("markIdList") List<Integer> markIdList);

    DrawInfo getDrawInfo(Integer drawId);

    @Update("update t_draw set draw_status = 'YWC' ,end_time = now() where draw_id = #{drawId}")
    void setDrawFinish(Integer drawId);

    @Select("select draw_status from t_draw where task_id = #{taskId}")
    List<String> getDrawListByTaskId(Integer taskId);

    @Update("update t_task set task_status = 3 where task_id = #{taskId}")
    void setTaskFinish(Integer taskId);
}
